<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;

use App\Http\Controllers\Controller;
use App\Model\Address;

/**
 * Class AddressController
 * @package App\Http\Controllers\Api
 * @User wuqin
 * @Date 2018/3/29 0029
 * @Time 17:49
 */
class AddressController extends Controller
{
    /**
     * 方法 : get_county
     * @User wuqin
     * @DateTime 2018-03-29 17:49
     * @param Request $request
     * @return array
     */
    public function get_county(Request $request)
    {
        $data = $request->input();
        if (empty($data))
            return return_array(1, '非法参数');
        $address = new Address();
        return return_array(0, '获取成功', $address->get_county($data["parent"]));
    }

    /**
     * 方法 : get_citys
     * @User wuqin
     * @DateTime 2018-03-29 17:49
     * @param Request $request
     * @return array
     */
    public function get_citys(Request $request)
    {
        $data = $request->input();
        if (empty($data))
            return return_array(1, '非法参数');
        $address = new Address();
        return return_array(0, '获取成功', $address->get_citys($data["parent"]));
    }

    /**
     * 方法 : get_provinces
     * @User wuqin
     * @DateTime 2018-03-29 17:49
     * @param Request $request
     * @return array
     */
    public function get_provinces(Request $request)
    {
        $address = new Address();
        return return_array(0, '获取成功', $address->get_provinces());
    }
}
